//
//  NSAttributedString+Extension.swift
//  WeiBO28
//
//  Created by 飞奔的羊 on 16/5/23.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

extension	NSAttributedString {
	//根据表情模型和字体对象创建一个符
	class func attributedWithEmoticon(emoticon: CZEmoticon, font: UIFont) -> NSAttributedString {
		let image = UIImage(named: emoticon.path!)
		let attachtment = CZTextAttachment()
		attachtment.emoticon = emoticon
		attachtment.image = image
	//
		let fontHeight = font.lineHeight
		attachtment.bounds = CGRect(x: 0, y: -4, width: fontHeight, height: fontHeight)
		let attr = NSAttributedString(attachment: attachtment)
		return attr
		
	}
}

